Skip to content

Conversation

@snissn
Copy link
Contributor

@snissn snissn commented Oct 31, 2025

Related Issues

Related FIP PR Link: filecoin-project/FIPs#1209
Related builtin actors PR link: filecoin-project/builtin-actors#1705

Proposed Changes

  • Add EIP-7702 (type 0x04) transaction support in chain/types/ethtypes:
    • RLP decode/encode for 0x04 including authorizationList (6-field tuples).
    • Per-type RLP element limit (13 for 0x04); tuple arity and yParity validation (0/1 only).
    • Authorization domain helpers: AuthorizationPreimage and AuthorizationKeccak implementing keccak256(0x05 || rlp([chain_id,address,nonce])).
    • Canonical CBOR params encoders: wrapper list for authorizations, and atomic ApplyAndCall params [ [tuple...], [to(20), value, input] ].
    • Robust integer parsing for chain_id/nonce up to uint64; reject non‑canonical encodings.
  • Route 0x04 to the EthAccount actor’s atomic ApplyAndCall entrypoint (current design; the earlier EVM.ApplyAndCall/Delegator path has been removed on this branch):
    • Eth7702TxArgs.ToUnsignedFilecoinMessageAtomic builds a Filecoin message targeting EthAccount.ApplyAndCall (FRC-42 method hash) with canonical CBOR params.
    • Feature‑gated by -tags eip7702_enabled; adds Eip7702FeatureEnabled flag and an EthAccountApplyAndCallActorAddr actor address stub used by tests (the older
      EvmApplyAndCallActorAddr remains as a deprecated alias for historical compatibility).
    • No Delegator path on this branch; routing is via EthAccount + VM intercept.
  • Receipts attribution for delegated execution:
    • adjustReceiptForDelegation surfaces delegatedTo from authorizationList and, if absent, from a synthetic event topic emitted by the EVM/VM runtime.
    • Topic keyed as keccak("Delegated(address)"); data is a 32‑byte ABI word whose last 20 bytes form the authority (EOA) address.
  • Gas estimation alignment to actor behavior:
    • Behavioral intrinsic overhead applied when ApplyAndCall is targeted and authorizationList is non‑empty.
    • Overhead grows monotonically with tuple count; disabled otherwise. Tuple counting is derived by CBOR shape inspection only.
  • OpenRPC updates: include 0x04 transaction shape and receipt fields so JSON‑RPC echoes authorizationList and delegatedTo when present.
  • Tests and fuzzing:
    • RLP decoding tests for tuple arity, yParity, per‑type list limit, canonical encoding, and overflow boundaries.
    • AuthorizationKeccak vectors for stability.
    • Receipts attribution tests covering both tuple echo and synthetic event extraction, precedence, multi‑event, and data parsing.
    • Gas estimation tests validating behavioral overhead application and monotonicity (no numeric pinning).
    • E2E tests itests/Eth7702 exercising send-path routing to EthAccount.ApplyAndCall, receipt fields (authorizationList/delegatedTo), and delegated CALL→EOA execution once the wasm
      bundle includes EthAccount.ApplyAndCall + VM intercept.
    • Mempool regression tests to ensure standard policies remain unchanged for 0x04 ingress.

Additional Info

  • Branch scope: internal development branch; EthAccount + VM intercept; no backward compatibility preserved. Canonical CBOR only (legacy shapes removed).
  • Activation: route enabled via build tag eip7702_enabled; actor bundle controls consensus activation. No runtime NV gates in Lotus.
  • Event topic: actor and Lotus both use Delegated(address) in final form for synthetic delegated attribution (see adjustReceiptForDelegation and ref‑fvm intercept tests).
  • Gas model: FEVM runs under FVM gas; estimation is behavioral. Tests avoid pinning absolute gas constants and effective prices.
  • Quick validation:
    • go test ./chain/types/ethtypes -run 7702 -count=1
    • go test ./node/impl/eth -run 7702 -count=1
    • E2E (post‑wasm): go test ./itests -run Eth7702 -tags eip7702_enabled -count=1

Checklist

Before you mark the PR ready for review, please make sure that:

snissn added 30 commits August 28, 2025 14:26
…, EthTx.authorizationList, and dispatch (Phase-1)
… ToUnsignedFilecoinMessage; adjust delegator types to avoid cycles; update AGENTS.md
…ons; actor: add no-op ApplyDelegations stub; update AGENTS.md
… expand AGENTS with state + scaffolding pointers
…dFilecoinMessage; delegator: add ApplyDelegationsParams; update AGENTS
… feature enabled and delegator-targeted; update docs
…e ToEthTx carries authorizationList; update AGENTS
…s; tests for writes and mismatched nonce; clarify actor stub
…; add unit test for application + nonce bump
…ests (unit-only; package requires FFI to run full tests)
…s completed; note scaffolded ApplyDelegations core
snissn added 23 commits November 7, 2025 12:55
…pt, trampoline, EXTCODE* semantics, and event ABI encoding
…zation; adjust next steps to focus on ref-fvm tests + legacy removal
…topic/data (authority) confirmed; tests to follow
…flict by centralizing ParseEthRevert in chain/types/ethtypes and updating tests
…ove single-EVM-actor references; mark EVM ApplyAndCall/InvokeAsEoa removed; update next steps and test plans
@snissn snissn marked this pull request as ready for review November 21, 2025 00:01
Copilot AI review requested due to automatic review settings November 21, 2025 00:01
Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@github-project-automation github-project-automation bot moved this from 📌 Triage to ⌨️ In Progress in FilOz Nov 21, 2025
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR implements EIP-7702 ("Set Code for EOAs") support in Lotus, enabling Ethereum-style delegated execution for Externally Owned Accounts (EOAs) on the Filecoin network. The implementation routes type-0x04 transactions to an EthAccount actor's ApplyAndCall entrypoint, with delegation semantics handled via VM intercept in ref-fvm.

Key Changes:

  • Added RLP decoding/encoding for type-0x04 transactions with authorization tuples and per-type element limits
  • Implemented routing to EthAccount.ApplyAndCall with canonical CBOR parameter encoding
  • Extended receipts to surface authorizationList and delegatedTo fields for attribution

Reviewed Changes

Copilot reviewed 68 out of 70 changed files in this pull request and generated no comments.

Show a summary per file
File Description
chain/types/ethtypes/rlp.go Added per-type RLP element limits for 0x04 (13 elements vs 12 for EIP-1559)
chain/types/ethtypes/eth_types.go Extended EthTxReceipt with authorizationList and delegatedTo fields
chain/types/ethtypes/eth_transactions.go Added 0x04 transaction parsing, CBOR decoding for ApplyAndCall params, and routing logic
node/impl/eth/utils.go Added embedded status decoding from ApplyAndCall return for receipts
node/impl/eth/receipt_7702_scaffold.go Implemented receipt adjustment for delegated execution attribution
node/impl/eth/gas_7702_scaffold.go Added behavioral gas overhead computation for authorization tuples
node/impl/eth/gas.go Integrated 7702 intrinsic overhead into gas estimation
Test files Comprehensive test coverage for RLP parsing, receipts, gas estimation, and E2E flows
Documentation OpenRPC updates and migration plan documentation
Comments suppressed due to low confidence (2)

node/impl/eth/utils.go:1

  • Use the named constant EIP7702TxType instead of the magic number 0x04 for consistency with the rest of the codebase and improved maintainability.
    itests/kit/node_unmanaged.go:1
  • This change appears unrelated to EIP-7702. If this is addressing a separate CI flakiness issue, it should be in a separate commit or PR to maintain atomic changes.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@snissn snissn changed the title FIP Implementation: Add support for EIP-7702 (Set Code for EOAs) feat(chain): add EIP-7702 set-code transactions for EOAs Nov 21, 2025
@github-actions github-actions bot dismissed their stale review November 21, 2025 00:38

PR title now matches the required format.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: ⌨️ In Progress

Development

Successfully merging this pull request may close these issues.

1 participant